<!--实现公告的内容显示-->

<?php
$connection =@mysqli_connect("localhost","root","root","educate");
if(!$connection){
    exit("<h1>数据库连接失败</h1>");
}
$sql = "select * from annocement_class ";
$result = mysqli_query($connection,$sql);

$get_name = $_GET['name'];  //存储get传过来的值
?>

<!DOCTYPE html>
<html lang="zh">

<head>
    <meta charset="utf-8" name="viewport"
        content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <meta name="renderer" content="webkit">
    <meta name="keywords" content="竞赛公告">
    <meta name="description" content="竞赛公告">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,Chrome=1" />
    <title>竞赛公告</title>
    <link rel="stylesheet" href="../competition/assets/css/common.css">
    <link rel="stylesheet" href="../competition/assets/css/more.css">
    <link rel="stylesheet" href="../assets/css/style.min.css">
    <link rel="stylesheet" href="../assets/css/plugins/plugins.min.css">
    <link rel="stylesheet" href="../assets/css/vendor/vendor.min.css">
</head>

<body>
    <div class="header-area header-three">
        <!-- Header Middle Start -->
        <div class="header-middle space-40 sticker" style="padding: 18px;">
            <div class="container">
                <div class="row align-items-center">
                    <div class="col-lg-3 col-6">
                        <div class="logo">
                            <a href="../index.php"><img src="../assets/images/logo/pos-circle-logo.jpg" alt=""
                                                        class="img-fluid"></a>
                        </div>
                    </div>
                    <div class="col-lg-9 col-6">
                        <div class="header-middle-inner">
                            <!-- Main Menu Start -->
                            <div class="header-menu float-left add-sticky">
                                <div class="sticky-container">
                                    <div class="logo">
                                        <a href="../index.php"><img src="../assets/images/logo/pos-circle-logo.jpg" alt=""
                                                                    class="img-fluid"></a>
                                    </div>
                                    <nav class="main-menu">
                                        <ul>
                                            <li>
                                                <a href="../index.php">首页<i></i></a>
                                            </li>
                                            <li>
                                                <a href="#">资源 <i class="fa fa-angle-down"></i></a>
                                                <div class="mega-menu dropdown">
                                                    <ul class="mega-menu-inner d-flex">
                                                        <li>
                                                            <a href="">环境搭建</a>
                                                            <ul>
                                                                <li><a href="http://www.mingw-w64.org/doku.php">MinGW-64-GCC</a></li>
                                                                <li><a href="https://www.python.org/">Python</a></li>
                                                                <li><a href="https://www.java.com/zh-CN/">Java</a></li>
                                                                <li><a href="https://www.anaconda.com/">Anacanda</a>
                                                                </li>
                                                            </ul>
                                                        </li>
                                                        <li>
                                                            <a href="">编译软件</a>
                                                            <ul>
                                                                <li><a href="https://www.codeblocks.org/">CodeBlocks</a></li>
                                                                <li><a href="https://www.jetbrains.com/pycharm/">Pycharm</a></li>
                                                                <li><a href="https://www.eclipse.org/downloads/">Eclipse</a></li>
                                                                <li><a href="https://code.visualstudio.com/">Visual Studio Code</a></li>
                                                            </ul>
                                                        </li>
                                                        <li>
                                                            <a href="">实用软件</a>
                                                            <ul>
                                                                <li><a href="404.html">Notpad++</a></li>
                                                                <li><a href="https://www.typora.io/">Typora</a></li>
                                                                <li><a href="http://www.sublimetext.com/3">Sublime Test</a></li>
                                                            </ul>
                                                        </li>
                                                    </ul>
                                                </div>
                                            </li>
                                            <li><a href="../notice/notice.php">课程公告</a></li>
                                            <li><a href="../competition/competition.html">竞赛公告</a></li>
                                            <li><a href="../about.html">平台介绍</a></li>
                                        </ul>
                                    </nav>
                                </div>
                            </div>
                            <!-- Main Menu End -->
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <!-- Header Middle End -->
    </div>



    <div class="main">
        <div class="centerBg"></div>
        <div class="mainCont commonWidth">
            <div class="listNav fl">
                <h4>竞赛公告</h4>
                    <ul class="listNavUl">
                        <!--                通过GET请求传值进行分类-->
                        <li ><a href="class.php?father=中国大学生计算机设计大赛">中国大学生计算机设计大赛</a>

                        </li>
                        <li><a href="class.php?father=中国软件杯">中国软件杯</a>

                        </li>
                        <li><a href="class.php?father=中国石油大学程序设计大赛">中国石油大学程序设计大赛</a>
                        </li>
                        <li><a href="class.php?father=大学计算机">大学计算机</a>

                        </li>
                    </ul>
            </div>
            <div class="commonRight fr">
                <div class="crumbsNav">
                    <a href="../index.php">首页</a>/
                    <a href="../competition/competition.html">竞赛公告</a>/
                </div>
                <div class="displaynews">

                        <?php
                        while($row = mysqli_fetch_assoc($result)) {     //mysqli_fetch_assoc()从结果集中取数据
                            if($row['name'] == $get_name) {

                                echo '  <div class="displayTitle">';
                                echo '<h3>'.$row['name'].'</h3>';
                               echo '<span>'.$row['date'].'</span>';
                               echo ' </div>';

                               echo '<div class="displayCont">';
                                echo $row['content'];
                                echo '</div>';
                            }
                        }
                        // 第五步：释放结果集
                        mysqli_free_result($result);
                        // 第六步：关闭连接
                        mysqli_close($connection);
                        ?>

<!--      !!!!!              暂时未实现附件-->

                    <div class="displayPage">
                        <a href="notice_detail.html">上一篇：2020秋季学期C语言程序设计课堂课程表</a></p>
                        <a href="notice_detail.html">下一篇：2020秋季学期C语言程序设计退补选通知</a>
                    </div>
                </div>
            </div>
            <div class="clear"></div>
        </div>
    </div>
    <footer >
        <div class="footer-bottom">
            <div class="container">
                <div class="row align-items-center">
                    <div class="col-lg-5 col-md-12 col-12">
                        <div class="footer-bottom-content">
                            <div class="footer-copyright">

                            </div>
                        </div>
                    </div>
                    <div class="col-lg-7 col-md-12 col-12">
                        <div class="payment">
                            <a href="#">
                                <p>Copyright &copy; 2022.计算机应用技术系 All rights reserved.</p>
                            </a>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </footer>


</body>

</html>
